package com.jamlu.framework.ui.status;

import android.support.annotation.NonNull;
import android.view.ViewGroup;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.jamlu.framework.model.bean.BaseBean;
import com.jamlu.framework.model.bean.BaseListBean;

import java.util.List;

import io.reactivex.functions.Consumer;

/**
 * Created by DMing at 2018/3/1 0001
 */

public interface IStatusView{

    /**
     * 注入一个状态Toast，回调是请求
     * @param statusRequest 请求
     */
    IStatus injectStatusToast(@NonNull StatusRequest statusRequest);
    /**
     * 注入一个状态Dialog，能通过返回键取消，回调是请求
     * @param statusRequest 请求
     */
    IStatus injectStatusDialog(@NonNull StatusRequest statusRequest);
    /**
     * 注入一个状态Dialog，设置是否返回键取消，回调是请求
     * @param cancelable 是否返回取消
     * @param statusRequest 请求
     */
    IStatus injectStatusDialog(boolean cancelable, @NonNull StatusRequest statusRequest);
    /**
     * 注入一个状态View，回调是请求
     * @param viewGroup 布局根
     * @param statusRequest 请求
     */
    IStatus injectStatusView(@NonNull ViewGroup viewGroup, @NonNull StatusRequest statusRequest);
    /**
     * 注入一个状态List View,服务对象是SmartRefresh + recyclerView，回调是请求
     * @param viewGroup 布局根
     * @param baseQuickAdapter 适配器
     * @param statusRequest 请求
     */
    StatusSmartRvView injectStatusSmartRv(@NonNull ViewGroup viewGroup, @NonNull BaseQuickAdapter baseQuickAdapter, @NonNull StatusRequest statusRequest);
    /**
     * 注入一个状态List View,服务对象是SmartRefresh + recyclerView，回调是请求
     * @param viewGroup 布局根
     * @param baseQuickAdapter 适配器
     * @param list list的类型必须与baseQuickAdapter一致
     * @param statusRequest 请求
     */
    StatusSmartRvView hasDataSmartRvView(@NonNull ViewGroup viewGroup, @NonNull BaseQuickAdapter baseQuickAdapter, List list, StatusRequest statusRequest);

    /**
     * 把rxJava请求与状态布局结合，不提供回调参数
     */
    //自定义状态布局
    IStatus requestStatusDefine(@NonNull IStatus iStatus, @NonNull RequestObservable requestObservable);
    //Toast布局
    IStatus requestStatusToast(@NonNull final RequestObservable requestObservable);
    //Dialog布局
    IStatus requestStatusDialog(@NonNull final RequestObservable requestObservable);
    //Dialog布局,可选取消返回
    IStatus requestStatusDialog(boolean cancelable, @NonNull final RequestObservable requestObservable);
    //View布局
    IStatus requestStatusView(@NonNull ViewGroup viewGroup, @NonNull final RequestObservable requestObservable);
    //List布局
    StatusSmartRvView requestStatusSmartRv(@NonNull ViewGroup viewGroup, @NonNull BaseQuickAdapter baseQuickAdapter, @NonNull final RequestObservable requestObservable);
    //List布局,一开始就有数据，可从缓存拿
    StatusSmartRvView requestHasDataSmartRv(@NonNull ViewGroup viewGroup, @NonNull BaseQuickAdapter baseQuickAdapter, @NonNull List list, @NonNull final RequestObservable requestObservable);
    /**
     * 把rxJava请求与状态布局结合，提供成功回调参数
     */
    IStatus requestStatusDefine(@NonNull IStatus iStatus, @NonNull RequestObservable requestObservable, @NonNull Consumer<? extends BaseBean> consumer);
    //自定义状态布局
    IStatus requestStatusToast(@NonNull final RequestObservable requestObservable, @NonNull final Consumer<? extends BaseBean> consumer);//Toast布局
    //Dialog布局
    IStatus requestStatusDialog(@NonNull final RequestObservable RequestObservable, @NonNull final Consumer<? extends BaseBean> consumer);
    //Dialog布局,可选取消返回
    IStatus requestStatusDialog(boolean cancelable, @NonNull final RequestObservable requestObservable, @NonNull final Consumer<? extends BaseBean> consumer);
    //View布局
    IStatus requestStatusView(@NonNull ViewGroup viewGroup, @NonNull final RequestObservable requestObservable, @NonNull final Consumer<? extends BaseBean> consumer);
    //List布局
    StatusSmartRvView requestStatusSmartRv(@NonNull ViewGroup viewGroup, @NonNull BaseQuickAdapter baseQuickAdapter, @NonNull final RequestObservable requestObservable, @NonNull final Consumer<? extends BaseListBean> consumer);
    //List布局,一开始就有数据，可从缓存拿
    StatusSmartRvView requestHasDataSmartRv(@NonNull ViewGroup viewGroup, @NonNull BaseQuickAdapter baseQuickAdapter, @NonNull List list, @NonNull final RequestObservable requestObservable, @NonNull final Consumer<? extends BaseListBean> consumer);
    /**
     * 把rxJava请求与状态布局结合，提供成功、失败回调参数
     */
    //自定义状态布局
    IStatus requestStatusDefine(@NonNull IStatus iStatus, @NonNull RequestObservable requestObservable, @NonNull Consumer<? extends BaseBean> consumer, @NonNull Consumer<Integer> failureStatus);
    //Toast布局
    IStatus requestStatusToast(@NonNull final RequestObservable requestObservable, @NonNull final Consumer<? extends BaseBean> consumer, @NonNull final Consumer<Integer> failureStatus);//Toast布局
    //Dialog布局
    IStatus requestStatusDialog(@NonNull final RequestObservable requestObservable, @NonNull final Consumer<? extends BaseBean> consumer, @NonNull final Consumer<Integer> failureStatus);
    //Dialog布局,可选取消返回
    IStatus requestStatusDialog(boolean cancelable, @NonNull final RequestObservable requestObservable, @NonNull final Consumer<? extends BaseBean> consumer, @NonNull final Consumer<Integer> failureStatus);
    //View布局
    IStatus requestStatusView(@NonNull ViewGroup viewGroup, @NonNull final RequestObservable requestObservable, @NonNull final Consumer<? extends BaseBean> consumer, @NonNull final Consumer<Integer> failureStatus);
    //List布局
    StatusSmartRvView requestStatusSmartRv(@NonNull ViewGroup viewGroup, @NonNull BaseQuickAdapter baseQuickAdapter, @NonNull final RequestObservable requestObservable, @NonNull final Consumer<? extends BaseListBean> consumer, @NonNull final Consumer<Integer> failureStatus);
    //List布局,一开始就有数据，可从缓存拿
    StatusSmartRvView requestHasDataSmartRv(@NonNull ViewGroup viewGroup, @NonNull BaseQuickAdapter baseQuickAdapter, @NonNull List list, @NonNull final RequestObservable requestObservable, @NonNull final Consumer<? extends BaseListBean> consumer, @NonNull final Consumer<Integer> failureStatus);
}
